|
|
Helpful Tips & Techniques Forms in WebExpress
The following is a quick guide to using forms with WebExpress v3.0. In particular, this discussion relates to the new form handler, mvforms.cgi. Before we go into that too much, however, a quick introduction to the Form Wizard is in order. The Form Wizard is activated whenever you create a new form in WebExpress. This is typically done with the Create Form selection from the Insert menu. The Form Wizard walks you through the creation of an interactive form, allowing you to collect valuable information from visitors to your site. You can choose to create a new form from one of the pre-set templates (highly recommended) or start from scratch. Even if one of our form templates doesn't match your specific needs, they usually provide an excellent starting point. Additionally, if you choose to use the new WebExpress Form Handler, it takes care of setting up the details for you. The WebExpress Form Handler, mvforms.cgi, is a cgi program to handle forms within WebExpress. The program is written in Perl, a popular language for cgi programs on the web because it is compatible with UNIX, Windows NT, and other popular web servers. If you use the Form Wizard in WebExpress, you can optionally choose to use mvforms.cgi, or as it is called in the Form Wizard, the WebExpress Form Handler. The Form Wizard will take care of most of the details of using mvforms.cgi for you. This document explains those details, and shows you how you can extend its use. A form handler manages the exchange of data after it has been submitted by a user in their web browser. The browser collects the data from the user, and then passes this data off to the form handler. The form handler then processes the data in an appropriate fashion, in this case by sending the data back to you via email. The data typed by the user is entered into form fields. These are fields you set up within WebExpress. The Form Wizard gets you started with commonly used forms. You can easily add other fields using the form tools. A second type of field is known as a “hidden” field. These generally provide directions to the form handler telling it how the data should be processed. The Form Wizard asks all the necessary questions and fills in all the hidden fields required by mvforms.cgi. In order to use mvforms.cgi, you will need to understand your ISP’s (or web hosting service) policies on cgi scripts. Since a cgi script is an executing computer program, some ISPs prevent them from being used on their systems. Others require them to be checked out by them first, and then installed into a special location. More and more ISPs, however, provide you a special location on your web site to install cgi scripts. This is typically a special directory named cgi-bin or cgi-local. Inquire with your ISP to find out the name of the location for cgi scripts, and have it ready when you run the Form Wizard. There are a couple of nasty technical details that you have to attend to if your forms don’t work right off the bat. You will need to ask your ISP for information, and change the mvforms.cgi file itself (using a standard text editor). Sorry about this, but they are necessary evils.
By default, mvforms.cgi sorts the fields in alphabetical order when preparing its email response. To give you total control over the order of the data in your form, the first two letters of each field name are used as sort characters. They are then stripped off when preparing the response. An example best illustrates this. Let’s say your have three fields in your form: Name, Address and City. If you named your fields Name, Address and City (totally logical), your response email would look like this:
The order is not too logical. However, taking advantage of mvform’s method of stripping the first two characters, you can better control the order. By naming your fields like this: aaName, abAddress, acCity, your email response looks like this:
This reads much better. Remember this when adding new fields to a form using mvforms.cgi. The Form Wizard already uses this technique, so you won’t have to worry about its fields. The Form Wizard adds all required hidden fields to your form automatically, but we list them all here for reference. The most important thing to remember is that all hidden fields for mvforms.cgi begin with a period ( . ), for example .email_dest. To edit hidden fields in WebExpress, use the Form Properties dialog. .email_dest
.intro
.subject
The following hidden fields may be used to give the behavior that you desire. .thanks_url
.remove_indexing
.required
Mvforms.cgi uses many strings for default responses. You can customize these by changing the mvforms.cgi file itself, using a standard text editor. You should do so with care, but we have made them easy to find. Look for this comment before each text string which may be changed: Remember that a text sting looks like this, "blah, blah, blah" and that anything in a text string that starts with a $ sign is a variable name and should not be changed (e.g. $string = "Some text with a $variable embedded.\n"; ). Some familiarity or knowledge of Perl scripts will be most useful if you intend to do any extensive customization. If you use WebExpress to transfer files to your web site, it will automatically transfer mvforms.cgi correctly. If you use some other FTP software, you must remember to set the file transfer mode to ASCII before sending the file. Failing to do so will surely result in errors when submitting the form. |
This web site
was created with WebExpress version 3.0 on February 19, 1998. Please
send your comments or questions to MicroVision Technical Support: support@mvd.com |